import { BASE_PATH, NOT_FOUND_PATH, DEFAULT_REDIRECT, DEFAULT_ROUTE_META } from '../constants';

// 404页面组件
const NotFoundPage = () => (
  <div style={{ 
    display: 'flex', 
    flexDirection: 'column', 
    alignItems: 'center', 
    justifyContent: 'center', 
    height: '100vh',
    textAlign: 'center'
  }}>
    <h1 style={{ fontSize: '4rem', margin: '0', color: '#666' }}>404</h1>
    <h2 style={{ margin: '1rem 0', color: '#999' }}>页面不存在</h2>
    <p style={{ color: '#ccc' }}>您访问的页面可能已被删除或不存在</p>
    <button 
      onClick={() => window.history.back()}
      style={{
        marginTop: '2rem',
        padding: '0.5rem 1rem',
        backgroundColor: '#007bff',
        color: 'white',
        border: 'none',
        borderRadius: '4px',
        cursor: 'pointer'
      }}
    >
      返回上一页
    </button>
  </div>
);

/**
 * 系统路由配置（重定向、404等）
 */
export const systemRoutes = [
  {
    path: BASE_PATH,
    redirect: DEFAULT_REDIRECT,
    exact: true,
    meta: {
      ...DEFAULT_ROUTE_META,
      title: '首页重定向',
      description: '根路径重定向到默认页面',
      keepAlive: false,
      affix: false,
    },
  },
  {
    path: NOT_FOUND_PATH,
    component: NotFoundPage,
    meta: {
      ...DEFAULT_ROUTE_META,
      title: '404页面',
      description: '页面不存在',
      keepAlive: false,
      affix: false,
    },
  },
];
